import java.util.*;
import java.lang.Exception;

class Channel {
	public LinkedList<SendEvent> sendQueue;
	public LinkedList<ReceiveEvent> receiveQueue;
	
	/*
	 * Instantiates a new instance of Channel
	 */
	public Channel() {
		sendQueue = new LinkedList<SendEvent>();
		receiveQueue = new LinkedList<ReceiveEvent>();
	}
	
	/*
	 * 
	 */
	public void Send(Object o) throws InterruptedException {
		SendEvent se = new SendEvent(this, o);
		se.Sync();
	}
	
	/*
	 * 
	 */
	public Object Receive() throws InterruptedException {
		ReceiveEvent re = new ReceiveEvent(this);
		re.Sync();
		return re.GetObject();
	}
}
